package com.wzh.advancelog.log.db;

import androidx.room.ColumnInfo;
import androidx.room.Entity;
import androidx.room.Ignore;
import androidx.room.Index;
import androidx.room.PrimaryKey;

/**
 * 创建log表，自增主键"id",索引logTime
 */
@Entity(tableName = "log", indices = {@Index(value = "logTime", unique = false)})
public class LogEntity {
    @PrimaryKey(autoGenerate = true)
    @ColumnInfo(name = "id", typeAffinity = ColumnInfo.INTEGER)
    long id;
    @ColumnInfo(name = "logTime", typeAffinity = ColumnInfo.INTEGER)
    long logTime;
    @ColumnInfo(name = "logLevel", typeAffinity = ColumnInfo.TEXT)
    String logLevel;
    @ColumnInfo(name = "tag", typeAffinity = ColumnInfo.TEXT)
    String tag;
    @ColumnInfo(name = "message", typeAffinity = ColumnInfo.TEXT)
    String message;
    @ColumnInfo(name = "isExported", typeAffinity = ColumnInfo.INTEGER)
    boolean isExported = false;

    @Ignore
    public LogEntity(long logTime, String logLevel, String tag, String message) {
        this.logTime = logTime;
        this.logLevel = logLevel;
        this.tag = tag;
        this.message = message;
    }

    public LogEntity(long id, long logTime, String logLevel, String tag, String message) {
        this.id = id;
        this.logTime = logTime;
        this.logLevel = logLevel;
        this.tag = tag;
        this.message = message;
    }

    public long getLogTime() {
        return logTime;
    }

    public void setLogTime(long logTime) {
        this.logTime = logTime;
    }

    public String getLogLevel() {
        return logLevel;
    }

    public void setLogLevel(String logLevel) {
        this.logLevel = logLevel;
    }

    public String getTag() {
        return tag;
    }

    public void setTag(String tag) {
        this.tag = tag;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public boolean isExported() {
        return isExported;
    }

    public void setExported(boolean exported) {
        isExported = exported;
    }
}
